WPS Office.apk(点击下载) / aazy.java


package defpackage;

import cn.wps.shareplay.message.Message;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.eclipse.paho.client.mqttv3.MqttTopic;

/* renamed from: aazy  reason: default package */
public final class aazy implements Iterable<aazx> {
    private static final String TAG = null;
    private aazp CCc;
    public ArrayList<String> CCg;
    private aazt CCh;
    private aazt CCi;
    private aazv CCj;
    HashMap<String, aazx> eWv;

    public aazy() {
        this.CCg = new ArrayList<>();
        this.eWv = new HashMap<>();
    }

    public aazy(aazp aazp) throws aazi {
        this(aazp, (aazt) null);
    }

    public aazy(aazp aazp, aazt aazt) throws aazi {
        this();
        if (aazp == null) {
            throw new IllegalArgumentException("container");
        } else if (aazt == null || !aazt.CBT) {
            this.CCc = aazp;
            this.CCi = aazt;
            this.CCj = aazz.f(aazt == null ? aazz.CCC : aazt.hdn());
            if (aazp.CBt != aazs.WRITE) {
                this.CCh = aazp.a(this.CCj);
                if (this.CCh != null) {
                    d(this.CCh);
                }
            }
        } else {
            throw new IllegalArgumentException("part");
        }
    }

    public aazy(aazt aazt) throws aazi {
        this(aazt.CBQ, aazt);
    }

    public aazy(aazy aazy, String str) {
        this();
        for (aazx aazx : aazy.eWv.values()) {
            if (str == null || aazx.eWp.equals(str)) {
                this.eWv.put(aazx.id, aazx);
            }
        }
    }

    private void d(aazt aazt) throws aazi {
        boolean z;
        abab abab;
        boolean z2 = false;
        try {
            ang Ig = new aoi().read(aazt.getInputStream()).Ig();
            ang[] cy = Ig.cy("Relationship");
            int length = cy.length;
            int i = 0;
            while (i < length) {
                ang ang = cy[i];
                String value = ang.cu("Id").getValue();
                String value2 = ang.cu("Type").getValue();
                if (!value2.equals("http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties")) {
                    z = z2;
                } else if (!z2) {
                    z = true;
                } else {
                    throw new aazi("OPC Compliance error [M4.1]: there is more than one core properties relationship in the package !");
                }
                amz cu = ang.cu("TargetMode");
                abab abab2 = abab.INTERNAL;
                if (cu != null) {
                    abab = cu.getValue().toLowerCase().equals("internal") ? abab.INTERNAL : abab.EXTERNAL;
                } else {
                    abab = abab2;
                }
                try {
                    String value3 = ang.cu("Target").getValue();
                    if (value3.indexOf(92) != -1) {
                        value3 = value3.replaceAll("\\\\", "/");
                    }
                    a(value3.contains("'") ? new vpn(MqttTopic.MULTI_LEVEL_WILDCARD + value3) : new vpn(value3), abab, value2, value);
                } catch (URISyntaxException e) {
                    hm.e(TAG, "Cannot convert " + "" + " in a valid relationship URI-> ignored", e);
                }
                i++;
                z2 = z;
            }
            Ig.Ir();
        } catch (Exception e2) {
            hm.e(TAG, "Exception", e2);
            throw new aazi(e2.getMessage());
        }
    }

    public final aazx a(vpn vpn, abab abab, String str, String str2) {
        String str3;
        if (str2 == null) {
            int i = 0;
            while (true) {
                i++;
                str3 = "rId" + i;
                if (this.eWv.get(str3) == null && !this.CCg.contains(str3)) {
                    break;
                }
            }
        } else {
            str3 = str2;
        }
        aazx aazx = new aazx(this.CCc, this.CCi, vpn, abab, str, str3);
        this.eWv.put(aazx.id, aazx);
        return aazx;
    }

    public final aazx azs(int i) {
        if (i < 0 || i > this.eWv.values().size()) {
            throw new IllegalArgumentException(FirebaseAnalytics.Param.INDEX);
        }
        int i2 = 0;
        for (aazx aazx : this.eWv.values()) {
            int i3 = i2 + 1;
            if (i == i2) {
                return aazx;
            }
            i2 = i3;
        }
        return null;
    }

    public final void clear() {
        this.CCg.clear();
        this.eWv.clear();
    }

    @Override // java.lang.Iterable
    public final Iterator<aazx> iterator() {
        return this.eWv.values().iterator();
    }

    public final int size() {
        return this.eWv.values().size();
    }

    public final String toString() {
        String str = this.eWv == null ? "relationshipsByID=null" : this.eWv.size() + " relationship(s) = [";
        String str2 = (this.CCh == null || this.CCh.CBR == null) ? str + ",relationshipPart=null" : str + Message.SEPARATE + this.CCh.CBR;
        String str3 = (this.CCi == null || this.CCi.CBR == null) ? str2 + ",sourcePart=null" : str2 + Message.SEPARATE + this.CCi.CBR;
        return (this.CCj != null ? str3 + Message.SEPARATE + this.CCj : str3 + ",uri=null)") + "]";
    }
}